#!/bin/bash


if [ `grep -w "^$1$" NAZ100Stocks|wc -l` == 1  ];then  ticker="$1.OQ"; fi
if [ `grep -w "^$1$" NYSE  |wc -l` == 1  ];then  ticker="$1.N"; fi

curl -stderr "http://www.investinvalue.com/2/1/detail.php?ric=$ticker"  > tmp$$

MarginofSafety=`cat tmp$$ |grep "MARGIN OF SAFETY of" |egrep -o "[0-9]+.[0-9]+[[:space:]]%"`
conservation=`cat tmp$$ |grep "Conservative Investors" |egrep -o -w star  |wc -l`
intricnsicvalue=`cat tmp$$|egrep -A 2 ">INTRINSIC VALUE" |tail -n 1 |egrep -o "[0-9]+.[0-9]+"`

echo "Margin of Safety(>50% ok)="$MarginofSafety",Conservation="$conservation",Intricnsic Value="$intricnsicvalue


